package com.sg.service.biz.framework.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.base.framework.req.*;
import com.sg.dto.biz.framework.req.*;
import com.sg.dto.biz.framework.res.*;
import com.sg.dto.integration.component.QueryClassMatchResultToAnswerDetailComReqDto;
import com.sg.dto.integration.component.QueryClassMatchResultToAnswerDetailComRespDto;
import com.sg.service.biz.framework.ChangeColumnService;
import com.wicket.okrcomponent.integration.ConfSchemeService;
import com.sg.common.exception.Assert;
import com.wicket.okrframework.common.exception.BizException;
import com.wicket.okrframework.dal.po.mbg.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class PositionServiceImpl
        implements com.wicket.okrframework.biz.service.PositionService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MPositionService mPositionService;
    @Resource
    private MChangeColumnService mChangeColumnService;
    @Resource
    private MPositionGradeService mPositionGradeService;
    @Resource
    private MGradeScopeService mGradeScopeService;
    @Resource
    private MStationTypeService mStationTypeService;
    @Resource
    private MTypeDictionaryService mTypeDictionaryService;
    @Resource
    private MStationService mStationService;
    @Resource
    private MPostService mPostService;
    @Resource
    private NbPosition nbPosition;
    @Resource
    private MPositionIdNameService mPositionIdNameService;
    @Resource
    private MInductionRecordService mInductionRecordService;
    @Resource
    private MUserinfoService mUserinfoService;
    @Resource
    private MStaffingService mStaffingService;
    @Resource
    private MStaffingAccountService mStaffingAccountService;
    @Resource
    private MDutyTargetDetailService mDutyTargetDetailService;
    @Resource
    private MUnionAppService mUnionAppService;
    @Resource
    private MOrganizationService mOrganizationService;
    @Resource
    private MDeptPositionRelationshipService mDeptPositionRelationshipService;
    @Resource
    private ConfSchemeService confSchemeService;
    @Resource
    private ChangeColumnService changeColumnService;

    /**
     * D1-3查询职务详情[930]
     * gen by moon at 10/27/2022, 9:32:27 PM
     */
    @Trace(operationName = "D1-3查询职务详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryPositionDetailRespDto queryPositionDetail(QueryPositionDetailReqDto reqDto) {


        Position position_1 = null;
        PositionGrade positionGrade_1 = null;
        List<GradeScope> listGradeScope_1 = new ArrayList<>();
        StationType stationType_1 = null;
        TypeDictionary typeDictionary_1 = null;
        Station station_1 = null;
        Post post_1 = null;
//步骤0: 1-3-05查询职务详情 - queryPositionDetail
        Position position = null;
        QueryPositionDetailReq queryPositionDetailReq = new QueryPositionDetailReq();
        if (reqDto != null) {
            queryPositionDetailReq.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:17957_1
            queryPositionDetailReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:22639_1
        }

        /*1-3-05查询职务详情[146]   */

        position = mPositionService.queryPositionDetail(queryPositionDetailReq);


        position_1 = position;

//步骤1: D1修订底层变更字段(公共) - reviseBaseChangeColCom
        ReviseBaseChangeColComRespDto reviseBaseChangeColComRespDto = null;
        if (position != null && position != null && position.getPositionGradeId() != null && position != null && position.getStationId() != null) {
            ReviseBaseChangeColComReqDto reviseBaseChangeColComReqDto = new ReviseBaseChangeColComReqDto();
            reviseBaseChangeColComReqDto.setTableTypeCode("OMS_ORG_POSITION");//sourceId:200543_1
            if (reqDto != null) {
                reviseBaseChangeColComReqDto.setEntityId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:200544_1
            }
            if (position != null) {
                reviseBaseChangeColComReqDto.setPositionGradeId(position.getPositionGradeId());//SimpleFieldAssign//sourceId:200822_1
                reviseBaseChangeColComReqDto.setStationId(position.getStationId());//SimpleFieldAssign//sourceId:200823_1
                reviseBaseChangeColComReqDto.setTypeDictionaryId(position.getTypeDictionaryId());//SimpleFieldAssign//sourceId:200824_1
                reviseBaseChangeColComReqDto.setPositionDutyDesc(position.getPositionDutyDesc());//SimpleFieldAssign//sourceId:200825_1
                reviseBaseChangeColComReqDto.setPositionTargetDesc(position.getPositionTargetDesc());//SimpleFieldAssign//sourceId:200826_1
            }

            /*D1修订底层变更字段(公共)[3921]   */
            Assert.isNull(reviseBaseChangeColComReqDto.getTableTypeCode(), "D1-3查询职务详情-D1修订底层变更字段(公共)-内容表类型编码不能为空", false);
            Assert.isNull(reviseBaseChangeColComReqDto.getEntityId(), "D1-3查询职务详情-D1修订底层变更字段(公共)-内容表主键ID不能为空", false);
            reviseBaseChangeColComRespDto = changeColumnService.reviseBaseChangeColCom(reviseBaseChangeColComReqDto);


        }

//步骤2: 1-3-03查询职务级别详情 - queryPositionGradeDetail
        PositionGrade positionGrade = null;
        if (reviseBaseChangeColComRespDto != null && reviseBaseChangeColComRespDto != null && reviseBaseChangeColComRespDto.getPositionGradeId() != null) {
            QueryPositionGradeDetailReq queryPositionGradeDetailReq = new QueryPositionGradeDetailReq();
            if (reviseBaseChangeColComRespDto != null) {
                queryPositionGradeDetailReq.setPositionGradeId(reviseBaseChangeColComRespDto.getPositionGradeId());//SimpleFieldAssign//sourceId:47941_1
            }

            /*1-3-03查询职务级别详情[136]   */

            positionGrade = mPositionGradeService.queryPositionGradeDetail(queryPositionGradeDetailReq);


            positionGrade_1 = positionGrade;
        }

//步骤3: 1-3-01查询等级范围列表 - queryGradeScopeList
        List<GradeScope> listGradeScope = new ArrayList<>();
        if (reviseBaseChangeColComRespDto != null && reviseBaseChangeColComRespDto != null && reviseBaseChangeColComRespDto.getPositionGradeId() != null) {
            QueryGradeScopeListReq queryGradeScopeListReq = new QueryGradeScopeListReq();
            queryGradeScopeListReq.setTypeCode("JOB_LEVEL");//sourceId:47996_1
            if (reviseBaseChangeColComRespDto != null) {
                queryGradeScopeListReq.setEntityId(reviseBaseChangeColComRespDto.getPositionGradeId());//SimpleFieldAssign//sourceId:47997_1
            }

            /*1-3-01查询等级范围列表[127]   */
            Assert.isNull(queryGradeScopeListReq.getTypeCode(), "D1-3查询职务详情-1-3-01查询等级范围列表-归属对象类型编码不能为空", false);
            listGradeScope = mGradeScopeService.queryGradeScopeList(queryGradeScopeListReq);


            listGradeScope_1 = listGradeScope;
        }

//步骤4: 1-3-04查询岗位类型详情 - queryStationTypeDetail
        StationType stationType = null;
        if (positionGrade != null && positionGrade != null && positionGrade.getStationTypeId() != null) {
            QueryStationTypeDetailReq queryStationTypeDetailReq = new QueryStationTypeDetailReq();
            if (positionGrade != null) {
                queryStationTypeDetailReq.setStationTypeId(positionGrade.getStationTypeId() != null ? String.valueOf(positionGrade.getStationTypeId()) : "");//SimpleFieldAssign//sourceId:47974_1
            }

            /*1-3-04查询岗位类型详情[141]   */

            stationType = mStationTypeService.queryStationTypeDetail(queryStationTypeDetailReq);


            stationType_1 = stationType;
        }

//步骤5: 1-3-16查询组织架构类型字典详情 - queryOrgClassDetail
        TypeDictionary typeDictionary = null;
        if (reviseBaseChangeColComRespDto != null) {
            QueryOrgClassDetailReq queryOrgClassDetailReq = new QueryOrgClassDetailReq();
            if (reviseBaseChangeColComRespDto != null) {
                queryOrgClassDetailReq.setTypeDictionaryId(reviseBaseChangeColComRespDto.getTypeDictionaryId());//SimpleFieldAssign//sourceId:48024_1
            }

            /*1-3-16查询组织架构类型字典详情[950]   */

            typeDictionary = mTypeDictionaryService.queryOrgClassDetail(queryOrgClassDetailReq);


            typeDictionary_1 = typeDictionary;
        }

//步骤6: 1-3-07查询岗位详情 - queryStationDetail
        Station station = null;
        if (reviseBaseChangeColComRespDto != null && reviseBaseChangeColComRespDto != null && reviseBaseChangeColComRespDto.getStationId() != null) {
            QueryStationDetailReq queryStationDetailReq = new QueryStationDetailReq();
            if (reviseBaseChangeColComRespDto != null) {
                queryStationDetailReq.setStationId(reviseBaseChangeColComRespDto.getStationId());//SimpleFieldAssign//sourceId:48049_1
            }

            /*1-3-07查询岗位详情[208]   */

            station = mStationService.queryStationDetail(queryStationDetailReq);


            station_1 = station;
        }

//步骤7: 1-3-08查询职位详情 - queryPostDetail
        Post post = null;
        if (station != null) {
            QueryPostDetailReq queryPostDetailReq = new QueryPostDetailReq();
            if (station != null) {
                queryPostDetailReq.setPostId(station.getPostId());//SimpleFieldAssign//sourceId:48060_1
            }

            /*1-3-08查询职位详情[213]   */

            post = mPostService.queryPostDetail(queryPostDetailReq);


            post_1 = post;
        }

        QueryPositionDetailRespDto retData = new QueryPositionDetailRespDto();
        retData.setOrgGradeScopeList(listGradeScope_1.stream().map(item -> BeanUtil.toBean(item, OrgGradeScopeDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:48158_1
        if (position_1 != null) {
            retData.setPositionId(position_1.getPositionId());//SimpleFieldAssign//sourceId:18187_1
            retData.setPositionIdName(position_1.getPositionIdName());//SimpleFieldAssign//sourceId:18188_1
            retData.setPositionType(position_1.getPositionType());//SimpleFieldAssign//sourceId:18190_1
            retData.setPositionNumber(position_1.getPositionNumber());//SimpleFieldAssign//sourceId:18194_1
            retData.setPositionIdNameId(position_1.getPositionIdNameId());//SimpleFieldAssign//sourceId:48142_1
            retData.setPositionGradeId(position_1.getPositionGradeId());//SimpleFieldAssign//sourceId:200858_1
            retData.setStationId(position_1.getStationId());//SimpleFieldAssign//sourceId:200859_1
            retData.setPositionDutyDesc(position_1.getPositionDutyDesc());//SimpleFieldAssign//sourceId:200860_1
            retData.setPositionTargetDesc(position_1.getPositionTargetDesc());//SimpleFieldAssign//sourceId:200861_1
            retData.setTypeDictionaryId(position_1.getTypeDictionaryId());//SimpleFieldAssign//sourceId:200857_1
            retData.setIsOrgPosition(position_1.getIsOrgPosition());//SimpleFieldAssign//sourceId:48143_1
            retData.setSubjectLifeCycle(position_1.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:48144_1
            retData.setOperationInductionId(position_1.getOperationInductionId());//SimpleFieldAssign//sourceId:48145_1
            retData.setOperateTime(position_1.getOperateTime());//SimpleFieldAssign//sourceId:48146_1
        }
        if (positionGrade_1 != null) {
            retData.setPositionGradeName(positionGrade_1.getPositionGradeName());//SimpleFieldAssign//sourceId:48155_1
            retData.setStationTypeId(positionGrade_1.getStationTypeId());//SimpleFieldAssign//sourceId:200863_1
        }
        if (station_1 != null) {
            retData.setStationName(station_1.getStationName());//SimpleFieldAssign//sourceId:48152_1
            retData.setPostId(station_1.getPostId());//SimpleFieldAssign//sourceId:200862_1
        }
        if (post_1 != null) {
            retData.setPostName(post_1.getPostName());//SimpleFieldAssign//sourceId:48154_1
        }
        if (typeDictionary_1 != null) {
            retData.setTypeDictionaryName(typeDictionary_1.getTypeDictionaryName());//SimpleFieldAssign//sourceId:48156_1
        }
        if (stationType_1 != null) {
            retData.setStationTypeName(stationType_1.getStationTypeName());//SimpleFieldAssign//sourceId:48157_1
        }


        return retData;
    }

    /**
     * D1-3查询职务列表（边界）[1653]
     * gen by moon at 10/2/2022, 12:17:38 AM
     */
    @Trace(operationName = "D1-3查询职务列表（边界）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryPositionListBorderRespDto queryPositionListBorder(QueryPositionListBorderReqDto reqDto) {


        List<Position> listPosition_1 = new ArrayList<>();
        List<PositionGrade> listPositionGrade_1 = new ArrayList<>();
//步骤0: 1-3-05查询职务列表 - queryPositionList
        List<Position> listPosition = new ArrayList<>();
        QueryPositionListReq queryPositionListReq = new QueryPositionListReq();
        queryPositionListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:48980_1
        if (reqDto != null) {
            queryPositionListReq.setPositionIdNameId(reqDto.getPositionIdNameId());//SimpleFieldAssign//sourceId:48991_1
            queryPositionListReq.setPositionGradeId(reqDto.getPositionGradeId());//SimpleFieldAssign//sourceId:49560_1
            queryPositionListReq.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:48979_1
            queryPositionListReq.setTypeDictionaryId(reqDto.getTypeDictionaryId());//SimpleFieldAssign//sourceId:49003_1
            queryPositionListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:49650_1
        }

        /*1-3-05查询职务列表[147]   */
        Assert.isNull(queryPositionListReq.getSubjectLifeCycle(), "D1-3查询职务列表（边界）-1-3-05查询职务列表-主体生命周期不能为空", false);
        listPosition = mPositionService.queryPositionList(queryPositionListReq);


        listPosition_1 = listPosition;

//步骤1: 1-3-03批量查询职务级别列表 - batchQueryPositionGradeList
        List<PositionGrade> listPositionGrade = new ArrayList<>();
        if (listPosition != null && listPosition.size() > 0) {
            BatchQueryPositionGradeListReq batchQueryPositionGradeListReq = new BatchQueryPositionGradeListReq();
            batchQueryPositionGradeListReq.setOrgPositionGradeList(listPosition.stream().map(item -> item.getPositionGradeId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:49012_1
            batchQueryPositionGradeListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49013_1

            /*1-3-03批量查询职务级别列表[1482]   */
            Assert.isNull(batchQueryPositionGradeListReq.getSubjectLifeCycle(), "D1-3查询职务列表（边界）-1-3-03批量查询职务级别列表-主体生命周期不能为空", false);
            listPositionGrade = mPositionGradeService.batchQueryPositionGradeList(batchQueryPositionGradeListReq);


            listPositionGrade_1 = listPositionGrade;
        }

        QueryPositionListBorderRespDto retData = new QueryPositionListBorderRespDto();
        //数据集融合  MoreListToOneSource
        if (listPosition_1 != null && !CollectionUtil.isEmpty(listPosition_1)) {
            for (Position position : listPosition_1) {
                OrgPositionDto retElm = new OrgPositionDto();
                retElm.setPositionId(position.getPositionId());//SimpleFieldAssign//sourceId:24440_2
                retElm.setPositionIdName(position.getPositionIdName());//SimpleFieldAssign//sourceId:24441_2
                retElm.setPositionType(position.getPositionType());//SimpleFieldAssign//sourceId:24462_2
                retElm.setPositionGradeId(position.getPositionGradeId());//SimpleFieldAssign//sourceId:24463_2
                retData.getOrgPositionList().add(retElm);
                if (listPositionGrade_1 != null) {
                    for (PositionGrade positionGrade : listPositionGrade_1) {
                        if (positionGrade.getPositionGradeId().equals(position.getPositionGradeId())) {
                            retElm.setPositionGradeName(positionGrade.getPositionGradeName());//SimpleFieldAssign//sourceId:24464_2
                        }
                    }
                }

            }
        }//sourceId:48984_1


        return retData;
    }

    /**
     * D1-3查询职务名称详情[1490]
     * gen by moon at 10/2/2022, 12:08:33 AM
     */
    @Trace(operationName = "D1-3查询职务名称详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryPositionTitleDetailRespDto queryPositionTitleDetail(QueryPositionTitleDetailReqDto reqDto) {


        PositionIdName positionIdName_1 = null;
        InductionRecord inductionRecord_1 = null;
        Userinfo userinfo_1 = null;
//步骤0: 1-3-06查询职务名称 - queryPositionTitleDetail
        PositionIdName positionIdName = null;
        QueryPositionTitleDetailReq queryPositionTitleDetailReq = new QueryPositionTitleDetailReq();
        if (reqDto != null) {
            queryPositionTitleDetailReq.setPositionIdNameId(reqDto.getPositionIdNameId());//SimpleFieldAssign//sourceId:39417_1
        }

        /*1-3-06查询职务名称[151]   */
        Assert.isNull(queryPositionTitleDetailReq.getPositionIdNameId(), "D1-3查询职务名称详情-1-3-06查询职务名称-职务名称ID不能为空", false);
        positionIdName = mPositionIdNameService.queryPositionTitleDetail(queryPositionTitleDetailReq);


        positionIdName_1 = positionIdName;

//步骤1: 1-3-13查询就职记录详情 - queryinductionRecordDetail
        InductionRecord inductionRecord = null;
        if (positionIdName != null) {
            QueryinductionRecordDetailReq queryinductionRecordDetailReq = new QueryinductionRecordDetailReq();
            if (positionIdName != null) {
                queryinductionRecordDetailReq.setInductionRecordId(positionIdName.getOperationInductionId());//SimpleFieldAssign//sourceId:39436_1
            }

            /*1-3-13查询就职记录详情[165]   */
            Assert.isNull(queryinductionRecordDetailReq.getInductionRecordId(), "D1-3查询职务名称详情-1-3-13查询就职记录详情-就职记录ID不能为空", false);
            inductionRecord = mInductionRecordService.queryinductionRecordDetail(queryinductionRecordDetailReq);


            inductionRecord_1 = inductionRecord;
        }

//步骤2: 1-2-02查询个人资料详情 - queryUserinfoDetail
        Userinfo userinfo = null;
        if (inductionRecord != null) {
            QueryUserinfoDetailReq queryUserinfoDetailReq = new QueryUserinfoDetailReq();
            if (inductionRecord != null) {
                queryUserinfoDetailReq.setUserId(inductionRecord.getUserId());//SimpleFieldAssign//sourceId:39515_1
            }

            /*1-2-02查询个人资料详情[155]   */
            Assert.isNull(queryUserinfoDetailReq.getUserId(), "D1-3查询职务名称详情-1-2-02查询个人资料详情-账号不能为空", false);
            userinfo = mUserinfoService.queryUserinfoDetail(queryUserinfoDetailReq);


            userinfo_1 = userinfo;
        }

        QueryPositionTitleDetailRespDto retData = new QueryPositionTitleDetailRespDto();
        if (positionIdName_1 != null) {
            retData.setPositionIdNameId(positionIdName_1.getPositionIdNameId());//SimpleFieldAssign//sourceId:39425_1
            retData.setPositionIdName(positionIdName_1.getPositionIdName());//SimpleFieldAssign//sourceId:39426_1
            retData.setSubjectLifeCycle(positionIdName_1.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:49640_1
            retData.setOperationInductionId(positionIdName_1.getOperationInductionId());//SimpleFieldAssign//sourceId:39428_1
            retData.setOperateTime(positionIdName_1.getOperateTime());//SimpleFieldAssign//sourceId:39429_1
        }
        if (inductionRecord_1 != null) {
            retData.setUserId(inductionRecord_1.getUserId());//SimpleFieldAssign//sourceId:49641_1
        }
        if (userinfo_1 != null) {
            retData.setUserFace(userinfo_1.getUserFace());//SimpleFieldAssign//sourceId:39524_1
            retData.setIdCardName(userinfo_1.getIdCardName());//SimpleFieldAssign//sourceId:39525_1
            retData.setNickName(userinfo_1.getNickName());//SimpleFieldAssign//sourceId:39526_1
        }


        return retData;
    }

    /**
     * D1-3修改职务名称[1488]
     * gen by moon at 10/2/2022, 12:08:19 AM
     */
    @Trace(operationName = "D1-3修改职务名称")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdatePositionTitleRespDto updatePositionTitle(UpdatePositionTitleReqDto reqDto) {


        //步骤0: 1-3-06修改职务名称 - updatePositionTitle
        boolean bOOLEAN;
        PositionIdName positionIdName = new PositionIdName();
        if (reqDto != null) {
            positionIdName.setPositionIdNameId(reqDto.getPositionIdNameId());//SimpleFieldAssign//sourceId:39356_1
            positionIdName.setPositionIdName(reqDto.getPositionIdName());//SimpleFieldAssign//sourceId:39357_1
            positionIdName.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:49567_1
        }

        /*1-3-06修改职务名称[149]   */
        Assert.isNull(positionIdName.getPositionIdNameId(), "D1-3修改职务名称-1-3-06修改职务名称-职务名称ID不能为空", false);
        bOOLEAN = mPositionIdNameService.updatePositionTitle(positionIdName);


        UpdatePositionTitleRespDto retData = new UpdatePositionTitleRespDto();


        return retData;
    }

    /**
     * D1-3新增职务名称[1485]
     * gen by moon at 10/2/2022, 12:08:06 AM
     */
    @Trace(operationName = "D1-3新增职务名称")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddPositionTitleRespDto addPositionTitle(AddPositionTitleReqDto reqDto) {


        String string_1 = null;
//步骤0: 1-3-06新增职务名称 - addPositionTitle
        String string = null;
        PositionIdName positionIdName = new PositionIdName();
        if (reqDto != null) {
            positionIdName.setPositionIdName(reqDto.getPositionIdName());//SimpleFieldAssign//sourceId:39242_1
            positionIdName.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:49575_1
        }

        /*1-3-06新增职务名称[148]   */
        Assert.isNull(positionIdName.getPositionIdName(), "D1-3新增职务名称-1-3-06新增职务名称-职务名称不能为空", false);
        Assert.isNull(positionIdName.getSubjectLifeCycle(), "D1-3新增职务名称-1-3-06新增职务名称-主体生命周期不能为空", false);
        string = mPositionIdNameService.addPositionTitle(positionIdName);


        string_1 = string;

        AddPositionTitleRespDto retData = new AddPositionTitleRespDto();
        if (string_1 != null) {
            retData.setPositionIdNameId(string_1);//SimpleFieldAssign//sourceId:39246_1
        }


        return retData;
    }

    /**
     * D1-3查询职务名称列表[1414]
     * gen by moon at 10/2/2022, 12:04:04 AM
     */
    @Trace(operationName = "D1-3查询职务名称列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryPositionTitleListRespDto queryPositionTitleList(QueryPositionTitleListReqDto reqDto) {


        List<PositionIdName> listPositionIdName_1 = new ArrayList<>();
//步骤0: 1-3-06查询职务名称列表 - queryPositionTitleList
        List<PositionIdName> listPositionIdName = new ArrayList<>();
        QueryPositionTitleListReq queryPositionTitleListReq = new QueryPositionTitleListReq();
        if (reqDto != null) {
            queryPositionTitleListReq.setPositionIdName(reqDto.getPositionIdName());//SimpleFieldAssign//sourceId:39554_1
            queryPositionTitleListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:42718_1
            queryPositionTitleListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:49242_1
        }

        /*1-3-06查询职务名称列表[152]   */

        listPositionIdName = mPositionIdNameService.queryPositionTitleList(queryPositionTitleListReq);


        listPositionIdName_1 = listPositionIdName;

        QueryPositionTitleListRespDto retData = new QueryPositionTitleListRespDto();
        retData.setOrgPositionIdNameList(listPositionIdName_1.stream().map(item -> BeanUtil.toBean(item, OrgPositionIdNameDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:33038_1


        return retData;
    }

    /**
     * D1-3查询编制去重职务列表（边界）[1764]
     * gen by moon at 10/2/2022, 12:25:21 AM
     */
    @Trace(operationName = "D1-3查询编制去重职务列表（边界）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryNoRepPositionListRespDto queryNoRepPositionList(QueryNoRepPositionListReqDto reqDto) {


        List<Position> listPosition_1 = new ArrayList<>();
//步骤0: 1-3-15查询编制列表 - queryStaffingList
        List<Staffing> listStaffing = new ArrayList<>();
        QueryStaffingListReq queryStaffingListReq = new QueryStaffingListReq();
        queryStaffingListReq.setIsArchive("FALSE");//sourceId:53536_1
        if (reqDto != null) {
            queryStaffingListReq.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:53535_1
        }

        /*1-3-15查询编制列表（查未去重职务）[192]   */
        Assert.isNull(queryStaffingListReq.getDeptId(), "D1-3查询编制去重职务列表（边界）-1-3-15查询编制列表（查未去重职务）-部门ID不能为空", false);
        Assert.isNull(queryStaffingListReq.getIsArchive(), "D1-3查询编制去重职务列表（边界）-1-3-15查询编制列表（查未去重职务）-是否存档不能为空", false);
        listStaffing = mStaffingService.queryStaffingList(queryStaffingListReq);


//步骤1: 1-3-05批量查询职务列表 - batchQueryPositionList
        List<Position> listPosition = new ArrayList<>();
        if (listStaffing != null && listStaffing.size() > 0) {
            BatchQueryPositionListReq batchQueryPositionListReq = new BatchQueryPositionListReq();
            batchQueryPositionListReq.setPositionList(listStaffing.stream().map(item -> item.getPositionId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:53528_1
            batchQueryPositionListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:53531_1

            /*1-3-05批量查询职务列表[1460]   */
            Assert.isNull(batchQueryPositionListReq.getSubjectLifeCycle(), "D1-3查询编制去重职务列表（边界）-1-3-05批量查询职务列表-主体生命周期不能为空", false);
            listPosition = mPositionService.batchQueryPositionList(batchQueryPositionListReq);


            listPosition_1 = listPosition;
        }

        QueryNoRepPositionListRespDto retData = new QueryNoRepPositionListRespDto();
        retData.setPositionList(listPosition_1.stream().map(item -> BeanUtil.toBean(item, PositionDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:63370_1


        return retData;
    }

    /**
     * D1-3查询职务列表[790]
     * gen by moon at 10/2/2022, 7:48:09 AM
     */
    @Trace(operationName = "D1-3查询职务列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryPositionListRespDto queryPositionList(QueryPositionListReqDto reqDto) {


        List<Position> listPosition_1 = new ArrayList<>();
//步骤0: 1-3-05查询职务列表 - queryPositionList
        List<Position> listPosition = new ArrayList<>();
        QueryPositionListReq queryPositionListReq = new QueryPositionListReq();
        if (reqDto != null) {
            queryPositionListReq.setPositionIdName(reqDto.getPositionIdName());//SimpleFieldAssign//sourceId:16647_1
            queryPositionListReq.setPositionIdNameId(reqDto.getPositionIdNameId());//SimpleFieldAssign//sourceId:16648_1
            queryPositionListReq.setPositionGradeId(reqDto.getPositionGradeId());//SimpleFieldAssign//sourceId:18811_1
            queryPositionListReq.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:16651_1
            queryPositionListReq.setTypeDictionaryId(reqDto.getTypeDictionaryId());//SimpleFieldAssign//sourceId:16652_1
            queryPositionListReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:53900_1
            queryPositionListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:21796_1
        }

        /*1-3-05查询职务列表[147]   */

        listPosition = mPositionService.queryPositionList(queryPositionListReq);


        listPosition_1 = listPosition;

        QueryPositionListRespDto retData = new QueryPositionListRespDto();
        retData.setOrgPositionList(listPosition_1.stream().map(item -> BeanUtil.toBean(item, OrgPositionDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:16662_1


        return retData;
    }

    /**
     * D1-3查询编制下职务列表[1730]
     * gen by moon at 10/2/2022, 12:23:54 AM
     */
    @Trace(operationName = "D1-3查询编制下职务列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryStaffingPositionListRespDto queryStaffingPositionList(QueryStaffingPositionListReqDto reqDto) {


        List<Position> listPosition_1 = new ArrayList<>();
        List<PositionGrade> listPositionGrade_1 = new ArrayList<>();
        List<Position> listPosition_4 = new ArrayList<>();
        if ((reqDto != null && reqDto.getStationId() != null && reqDto != null && reqDto.getPositionGradeId() == null && reqDto != null && reqDto.getOrganizationId() == null) || (reqDto != null && reqDto.getStationId() == null && reqDto != null && reqDto.getPositionGradeId() != null && reqDto != null && reqDto.getOrganizationId() == null)) {
            //if((D1-3查询带编制统计职务列表.关联岗位ID 不等于空  and D1-3查询带编制统计职务列表.职务级别ID 等于空  and D1-3查询带编制统计职务列表.组织ID 等于空 ) or (D1-3查询带编制统计职务列表.关联岗位ID 等于空  and D1-3查询带编制统计职务列表.职务级别ID 不等于空  and D1-3查询带编制统计职务列表.组织ID 等于空 ))  1964

            List<Position> listPosition = new ArrayList<>();
            QueryPositionListReq queryPositionListReq = new QueryPositionListReq();
            queryPositionListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52175_1_1966
            queryPositionListReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:52176_1_1966
            if (reqDto != null) {
                queryPositionListReq.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:53312_1_1966
                queryPositionListReq.setPositionGradeId(reqDto.getPositionGradeId());//SimpleFieldAssign//sourceId:53313_1_1966
            }

            /*1-3-05查询职务列表[147]   */
            Assert.isNull(queryPositionListReq.getSubjectLifeCycle(), "D1-3查询编制下职务列表-1-3-05查询职务列表-主体生命周期不能为空", false);
            Assert.isNull(queryPositionListReq.getSpaceId(), "D1-3查询编制下职务列表-1-3-05查询职务列表-创建于空间ID不能为空", false);
            listPosition = mPositionService.queryPositionList(queryPositionListReq);


            listPosition_1 = listPosition;
            List<PositionGrade> listPositionGrade = new ArrayList<>();
            if (listPosition != null && listPosition.size() > 0) {
                BatchQueryPositionGradeListReq batchQueryPositionGradeListReq = new BatchQueryPositionGradeListReq();
                batchQueryPositionGradeListReq.setOrgPositionGradeList(listPosition.stream().map(item -> item.getPositionGradeId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52180_1_1967
                batchQueryPositionGradeListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52184_1_1967

                /*1-3-03批量查询职务级别列表[1482]   */
                Assert.isNull(batchQueryPositionGradeListReq.getSubjectLifeCycle(), "D1-3查询编制下职务列表-1-3-03批量查询职务级别列表-主体生命周期不能为空", false);
                listPositionGrade = mPositionGradeService.batchQueryPositionGradeList(batchQueryPositionGradeListReq);


                listPositionGrade_1 = listPositionGrade;
            }
//processBranchName:正常结束 ,processBranchId:1968

        } else if ((reqDto != null && reqDto.getStationId() != null && reqDto != null && reqDto.getPositionGradeId() == null && reqDto != null && reqDto.getOrganizationId() != null) || (reqDto != null && reqDto.getStationId() == null && reqDto != null && reqDto.getPositionGradeId() != null && reqDto != null && reqDto.getOrganizationId() != null)) {
            //elseif((D1-3查询带编制统计职务列表.关联岗位ID 不等于空  and D1-3查询带编制统计职务列表.职务级别ID 等于空  and D1-3查询带编制统计职务列表.组织ID 不等于空 ) or (D1-3查询带编制统计职务列表.关联岗位ID 等于空  and D1-3查询带编制统计职务列表.职务级别ID 不等于空  and D1-3查询带编制统计职务列表.组织ID 不等于空 ))  1970

            List<Position> listPosition_2 = new ArrayList<>();
            QueryPositionListReq queryPositionListReq_1 = new QueryPositionListReq();
            queryPositionListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52175_1_1971
            queryPositionListReq_1.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:52176_1_1971
            if (reqDto != null) {
                queryPositionListReq_1.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:53312_1_1971
                queryPositionListReq_1.setPositionGradeId(reqDto.getPositionGradeId());//SimpleFieldAssign//sourceId:53313_1_1971
            }

            /*1-3-05查询职务列表[147]   */
            Assert.isNull(queryPositionListReq_1.getSubjectLifeCycle(), "D1-3查询编制下职务列表-1-3-05查询职务列表-主体生命周期不能为空", false);
            Assert.isNull(queryPositionListReq_1.getSpaceId(), "D1-3查询编制下职务列表-1-3-05查询职务列表-创建于空间ID不能为空", false);
            listPosition_2 = mPositionService.queryPositionList(queryPositionListReq_1);


            listPosition_1 = listPosition_2;
            List<Staffing> listStaffing = new ArrayList<>();
            if (listPosition_2 != null && listPosition_2.size() > 0) {
                BatchQueryPostMatchingStaffingReq batchQueryPostMatchingStaffingReq = new BatchQueryPostMatchingStaffingReq();
                batchQueryPostMatchingStaffingReq.setStaffingList(listPosition_2.stream().map(item -> item.getPositionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:53320_1_1972
                if (reqDto != null) {
                    batchQueryPostMatchingStaffingReq.setOrganizationId(reqDto.getOrganizationId());//SimpleFieldAssign//sourceId:53327_1_1972
                }

                /*1-3-14批量查询职务匹配编制列表[1282]   */

                listStaffing = mStaffingService.batchQueryPostMatchingStaffing(batchQueryPostMatchingStaffingReq);


            }
            List<Position> listPosition_3 = new ArrayList<>();
            if (listStaffing != null && listStaffing.size() > 0) {
                BatchQueryPositionListReq batchQueryPositionListReq = new BatchQueryPositionListReq();
                batchQueryPositionListReq.setPositionList(listStaffing.stream().map(item -> item.getPositionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:53338_1_1974

                /*1-3-05批量查询职务列表[1460]   */

                listPosition_3 = mPositionService.batchQueryPositionList(batchQueryPositionListReq);


                listPosition_4 = listPosition_3;
            }
            List<PositionGrade> listPositionGrade_2 = new ArrayList<>();
            if (listPosition_3 != null && listPosition_3.size() > 0) {
                BatchQueryPositionGradeListReq batchQueryPositionGradeListReq_1 = new BatchQueryPositionGradeListReq();
                batchQueryPositionGradeListReq_1.setOrgPositionGradeList(listPosition_3.stream().map(item -> item.getPositionGradeId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52180_1_1975
                batchQueryPositionGradeListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52184_1_1975

                /*1-3-03批量查询职务级别列表[1482]   */
                Assert.isNull(batchQueryPositionGradeListReq_1.getSubjectLifeCycle(), "D1-3查询编制下职务列表-1-3-03批量查询职务级别列表-主体生命周期不能为空", false);
                listPositionGrade_2 = mPositionGradeService.batchQueryPositionGradeList(batchQueryPositionGradeListReq_1);


                listPositionGrade_1 = listPositionGrade_2;
            }
//processBranchName:正常结束 ,processBranchId:1976

        } else {
            //else  1981

//异常结束 1982
            throw new BizException("C00028", "对不起，没有数据！！", false);
        }
        QueryStaffingPositionListRespDto retData = new QueryStaffingPositionListRespDto();
        //数据集融合  MoreListToOneSource
        if (listPosition_1 != null && !CollectionUtil.isEmpty(listPosition_1)) {
            for (Position position : listPosition_1) {
                OrgPositionDto retElm = new OrgPositionDto();
                retElm.setPositionId(position.getPositionId());//SimpleFieldAssign//sourceId:27459_2
                retElm.setPositionIdName(position.getPositionIdName());//SimpleFieldAssign//sourceId:27461_2
                retElm.setPositionGradeId(position.getPositionGradeId());//SimpleFieldAssign//sourceId:27465_2
                retData.getOrgPositionList().add(retElm);
                if (listPositionGrade_1 != null) {
                    for (PositionGrade positionGrade : listPositionGrade_1) {
                        if (positionGrade.getPositionGradeId().equals(position.getPositionGradeId())) {
                            retElm.setPositionGradeName(positionGrade.getPositionGradeName());//SimpleFieldAssign//sourceId:27462_2
                        }
                    }
                }

            }
        }
//数据集融合  MoreListToOneSource
        if (listPosition_4 != null && !CollectionUtil.isEmpty(listPosition_4)) {
            for (Position position : listPosition_4) {
                OrgPositionDto retElm = new OrgPositionDto();
                retElm.setPositionId(position.getPositionId());//SimpleFieldAssign//sourceId:27459_2
                retElm.setPositionIdName(position.getPositionIdName());//SimpleFieldAssign//sourceId:27461_2
                retElm.setPositionGradeId(position.getPositionGradeId());//SimpleFieldAssign//sourceId:27465_2
                retData.getOrgPositionList().add(retElm);
                if (listPositionGrade_1 != null) {
                    for (PositionGrade positionGrade : listPositionGrade_1) {
                        if (positionGrade.getPositionGradeId().equals(position.getPositionGradeId())) {
                            retElm.setPositionGradeName(positionGrade.getPositionGradeName());//SimpleFieldAssign//sourceId:27462_2
                        }
                    }
                }

            }
        }//sourceId:52199_1


        return retData;
    }

    /**
     * D1-3存档职务[904]
     * gen by moon at 10/2/2022, 7:50:11 AM
     */
    @Trace(operationName = "D1-3存档职务")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ArchivePositionRespDto archivePosition(ArchivePositionReqDto reqDto) {


        //步骤0: 1-3-14查询编制账户详情 - queryStaffingAccountDetail
        StaffingAccount staffingAccount = null;
        QueryStaffingAccountDetailReq queryStaffingAccountDetailReq = new QueryStaffingAccountDetailReq();
        queryStaffingAccountDetailReq.setTypeCode("POSITION");//sourceId:201559_1
        queryStaffingAccountDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:201561_1
        if (reqDto != null) {
            queryStaffingAccountDetailReq.setEntityId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:201560_1
        }

        /*1-3-14查当前职务的编制账户[175]   */
        Assert.isNull(queryStaffingAccountDetailReq.getTypeCode(), "D1-3存档职务-1-3-14查当前职务的编制账户-所属对象实例类型不能为空", false);
        Assert.isNull(queryStaffingAccountDetailReq.getEntityId(), "D1-3存档职务-1-3-14查当前职务的编制账户-所属对象实例ID不能为空", false);
        Assert.isNull(queryStaffingAccountDetailReq.getSubjectLifeCycle(), "D1-3存档职务-1-3-14查当前职务的编制账户-主体生命周期不能为空", false);
        staffingAccount = mStaffingAccountService.queryStaffingAccountDetail(queryStaffingAccountDetailReq);


//步骤1: 1-3-14修改编制账户 - updateStaffingAccount
        boolean bOOLEAN;
        if (staffingAccount != null) {
            StaffingAccount staffingAccount_2 = new StaffingAccount();
            staffingAccount_2.setSubjectLifeCycle("ARCHIVING");//sourceId:47752_1
            staffingAccount_2.setIsArchive("TRUE");//sourceId:47753_1
            if (staffingAccount != null) {
                staffingAccount_2.setStaffingAccountId(staffingAccount.getStaffingAccountId());//SimpleFieldAssign//sourceId:201566_1
            }

            /*1-3-14修改编制账户（存档职务编制账户）[172]   */
            Assert.isNull(staffingAccount_2.getStaffingAccountId(), "D1-3存档职务-1-3-14修改编制账户（存档职务编制账户）-编制账户ID不能为空", false);
            Assert.isNull(staffingAccount_2.getSubjectLifeCycle(), "D1-3存档职务-1-3-14修改编制账户（存档职务编制账户）-主体生命周期不能为空", false);
            Assert.isNull(staffingAccount_2.getIsArchive(), "D1-3存档职务-1-3-14修改编制账户（存档职务编制账户）-是否存档不能为空", false);
            bOOLEAN = mStaffingAccountService.updateStaffingAccount(staffingAccount_2);


        }

//步骤2: 1-3-10查询目标职责明细列表 - queryTargetDetailsList
        List<DutyTargetDetail> listDutyTargetDetail = new ArrayList<>();
        QueryTargetDetailsListReq queryTargetDetailsListReq = new QueryTargetDetailsListReq();
        queryTargetDetailsListReq.setTypeCode("POSITION");//sourceId:49586_1
        queryTargetDetailsListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49601_1
        queryTargetDetailsListReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:49628_1
        if (reqDto != null) {
            queryTargetDetailsListReq.setEntityId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:49587_1
        }

        /*1-3-10查询目标职责明细列表（查当前有效）[181]   */
        Assert.isNull(queryTargetDetailsListReq.getTypeCode(), "D1-3存档职务-1-3-10查询目标职责明细列表（查当前有效）-所属对象实例类型不能为空", false);
        Assert.isNull(queryTargetDetailsListReq.getEntityId(), "D1-3存档职务-1-3-10查询目标职责明细列表（查当前有效）-所属对象实例ID不能为空", false);
        Assert.isNull(queryTargetDetailsListReq.getSubjectLifeCycle(), "D1-3存档职务-1-3-10查询目标职责明细列表（查当前有效）-主体生命周期不能为空", false);
        Assert.isNull(queryTargetDetailsListReq.getSpaceId(), "D1-3存档职务-1-3-10查询目标职责明细列表（查当前有效）-创建于空间ID不能为空", false);
        listDutyTargetDetail = mDutyTargetDetailService.queryTargetDetailsList(queryTargetDetailsListReq);


//步骤3: 1-3-10批量修改目标职责明细 - batchUpdateTargetDetail
        boolean bOOLEAN_1;
        if (listDutyTargetDetail != null && listDutyTargetDetail.size() > 0) {
            List<DutyTargetDetail> listDutyTargetDetail_2 = new ArrayList<>();
            listDutyTargetDetail_2 = listDutyTargetDetail.stream().map(item -> BeanUtil.toBean(item, DutyTargetDetail.class)).collect(Collectors.toList());//objList-to-objLists//sourceId:49624_1
//listDutyTargetDetail_2.setIsArchive("TRUE");//sourceId:49625_1
//listDutyTargetDetail_2.setSubjectLifeCycle("ARCHIVING");//sourceId:49626_1

            /*1-3-10批量修改目标职责明细（批量存档）[933]   */
            Assert.isNull(listDutyTargetDetail_2, "D1-3存档职务-1-3-10批量修改目标职责明细（批量存档）-是否存档不能为空", false);
            Assert.isNull(listDutyTargetDetail_2, "D1-3存档职务-1-3-10批量修改目标职责明细（批量存档）-主体生命周期不能为空", false);
            bOOLEAN_1 = mDutyTargetDetailService.batchUpdateTargetDetail(listDutyTargetDetail_2);


        }

//步骤4: 1-3-10查询目标职责明细列表 - queryTargetDetailsList
        List<DutyTargetDetail> listDutyTargetDetail_3 = new ArrayList<>();
        QueryTargetDetailsListReq queryTargetDetailsListReq_1 = new QueryTargetDetailsListReq();
        queryTargetDetailsListReq_1.setTypeCode("POSITION");//sourceId:49603_1
        queryTargetDetailsListReq_1.setSubjectLifeCycle("EDITING");//sourceId:49606_1
        queryTargetDetailsListReq_1.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:49629_1
        if (reqDto != null) {
            queryTargetDetailsListReq_1.setEntityId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:49604_1
        }

        /*1-3-10查询目标职责明细列表（查正在编辑）[181]   */
        Assert.isNull(queryTargetDetailsListReq_1.getTypeCode(), "D1-3存档职务-1-3-10查询目标职责明细列表（查正在编辑）-所属对象实例类型不能为空", false);
        Assert.isNull(queryTargetDetailsListReq_1.getEntityId(), "D1-3存档职务-1-3-10查询目标职责明细列表（查正在编辑）-所属对象实例ID不能为空", false);
        Assert.isNull(queryTargetDetailsListReq_1.getSubjectLifeCycle(), "D1-3存档职务-1-3-10查询目标职责明细列表（查正在编辑）-主体生命周期不能为空", false);
        Assert.isNull(queryTargetDetailsListReq_1.getSpaceId(), "D1-3存档职务-1-3-10查询目标职责明细列表（查正在编辑）-创建于空间ID不能为空", false);
        listDutyTargetDetail_3 = mDutyTargetDetailService.queryTargetDetailsList(queryTargetDetailsListReq_1);


//步骤5: 1-3-10批量删除目标职责明细 - batchDeleteTargetDetail
        boolean bOOLEAN_2;
        if (listDutyTargetDetail_3 != null && listDutyTargetDetail_3.size() > 0) {
            List<String> listString = new ArrayList<>();
            listString = listDutyTargetDetail_3.stream().map(item -> item.getDutyTargetDetailId())
                    .collect(Collectors.toList());/*list-to-strings*///sourceId:49620_1

            /*1-3-10批量删除目标职责明细[942]   */

            bOOLEAN_2 = mDutyTargetDetailService.batchDeleteTargetDetail(listString);


        }

//步骤6: 1-3-05修改职务 - updatePosition
        boolean bOOLEAN_3;
        Position position = new Position();
        position.setSubjectLifeCycle("ARCHIVING");//sourceId:47705_1
        position.setIsArchive("TRUE");//sourceId:47706_1
        if (reqDto != null) {
            position.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:17058_1
        }

        /*1-3-05修改职务（存档职务）[144]   */
        Assert.isNull(position.getPositionId(), "D1-3存档职务-1-3-05修改职务（存档职务）-职务ID不能为空", false);
        Assert.isNull(position.getSubjectLifeCycle(), "D1-3存档职务-1-3-05修改职务（存档职务）-主体生命周期不能为空", false);
        Assert.isNull(position.getIsArchive(), "D1-3存档职务-1-3-05修改职务（存档职务）-是否存档不能为空", false);
        bOOLEAN_3 = mPositionService.updatePosition(position);


        ArchivePositionRespDto retData = new ArchivePositionRespDto();


        return retData;
    }

    /**
     * D1-3-修改职务[838]
     * gen by moon at 10/2/2022, 7:49:57 AM
     */
    @Trace(operationName = "D1-3-修改职务")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdatePositionRespDto updatePosition(UpdatePositionReqDto reqDto) {


        //virtualUsage 1-3-05修改职务  1566
        boolean bOOLEAN;
        Position position = new Position();
        if (reqDto != null) {
            position.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:16630_1_1566
            position.setPositionIdName(reqDto.getPositionIdName());//SimpleFieldAssign//sourceId:16631_1_1566
            position.setPositionIdNameId(reqDto.getPositionIdNameId());//SimpleFieldAssign//sourceId:16632_1_1566
            position.setPositionNumber(reqDto.getPositionNumber());//SimpleFieldAssign//sourceId:16639_1_1566
            position.setPositionGradeId(reqDto.getPositionGradeId());//SimpleFieldAssign//sourceId:16635_1_1566
            position.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:16636_1_1566
            position.setTypeDictionaryId(reqDto.getTypeDictionaryId());//SimpleFieldAssign//sourceId:16637_1_1566
            position.setPositionDutyDesc(reqDto.getPositionDutyDesc());//SimpleFieldAssign//sourceId:16640_1_1566
            position.setPositionTargetDesc(reqDto.getPositionTargetDesc());//SimpleFieldAssign//sourceId:16641_1_1566
            position.setPositionType(reqDto.getPositionType());//SimpleFieldAssign//sourceId:16633_1_1566
            position.setIsOrgPosition(reqDto.getIsOrgPosition());//SimpleFieldAssign//sourceId:16642_1_1566
            position.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47450_1_1566
        }

        /*1-3-05修改职务[144]   */
        Assert.isNull(position.getPositionId(), "D1-3-修改职务-1-3-05修改职务-职务ID不能为空", false);
        bOOLEAN = mPositionService.updatePosition(position);


//virtualUsage D2-3查询分组匹配结果转答案(公共)(跨服务）  5669
        QueryClassMatchResultToAnswerDetailComRespDto queryClassMatchResultToAnswerDetailComRespDto = null;
        QueryClassMatchResultToAnswerDetailComReqDto queryClassMatchResultToAnswerDetailComReqDto = new QueryClassMatchResultToAnswerDetailComReqDto();
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:105959_1_5669
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjType("TENANT_SPACE");//sourceId:105960_1_5669
        queryClassMatchResultToAnswerDetailComReqDto.setConfItemClassCode("ORG_SET_CLASS");//CUSTOM_CONVENTION//sourceId:105918_1_5669
        queryClassMatchResultToAnswerDetailComReqDto.setIsInitialScheme("TRUE");//sourceId:308514_1_5669
        queryClassMatchResultToAnswerDetailComReqDto.setIsPlatData("FALSE");//sourceId:308515_1_5669

        /*D2-3查询分组匹配结果转答案(公共)(跨服务）[3088]   */
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getResultAspObjId(), "D1-3-修改职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-答案归属对象ID不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getResultAspObjType(), "D1-3-修改职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-答案归属对象类型不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getConfItemClassCode(), "D1-3-修改职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-分组标识不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsInitialScheme(), "D1-3-修改职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否初始方案答案不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsPlatData(), "D1-3-修改职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否平台数据不能为空", false);
        queryClassMatchResultToAnswerDetailComRespDto = confSchemeService.queryClassMatchResultToAnswerDetailCom(queryClassMatchResultToAnswerDetailComReqDto).getData();


        if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID") && queryClassMatchResultToAnswerDetailComRespDto != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg() != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg().equals("FALSE"))) {
            //if((D1-3-修改职务.主体生命周期 等于 当前有效 and D2-3查询分组匹配结果转答案(公共)(跨服务）.是否开启多组织 等于 否))  1569

            String string = null;
            StaffingAccount staffingAccount = new StaffingAccount();
            staffingAccount.setTypeCode("POSITION");//sourceId:49158_1_1570
            staffingAccount.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49160_1_1570
            if (reqDto != null) {
                staffingAccount.setEntityId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:49159_1_1570
            }

            /*1-3-14新增编制账户[171]   */
            Assert.isNull(staffingAccount.getTypeCode(), "D1-3-修改职务-1-3-14新增编制账户-所属对象实例类型不能为空", false);
            Assert.isNull(staffingAccount.getEntityId(), "D1-3-修改职务-1-3-14新增编制账户-所属对象实例ID不能为空", false);
            Assert.isNull(staffingAccount.getSubjectLifeCycle(), "D1-3-修改职务-1-3-14新增编制账户-主体生命周期不能为空", false);
            string = mStaffingAccountService.addStaffingAccount(staffingAccount);


            Organization organization = null;
            QueryOrgDetailReq queryOrgDetailReq = new QueryOrgDetailReq();
            queryOrgDetailReq.setIsHighOrg("TRUE");//sourceId:49129_1_1571
            queryOrgDetailReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:49130_1_1571

            /*1-3-12查询组织详情（查最高组织ID）[201]   */
            Assert.isNull(queryOrgDetailReq.getIsHighOrg(), "D1-3-修改职务-1-3-12查询组织详情（查最高组织ID）-是否最高组织不能为空", false);
            Assert.isNull(queryOrgDetailReq.getSpaceId(), "D1-3-修改职务-1-3-12查询组织详情（查最高组织ID）-创建于空间ID不能为空", false);
            organization = mOrganizationService.queryOrgDetail(queryOrgDetailReq);


            String string_2 = null;
            if (organization != null) {
                DeptPositionRelationship deptPositionRelationship = new DeptPositionRelationship();
                deptPositionRelationship.setOrgTypeCode("ORGANIZATION");//sourceId:49152_1_1572
                deptPositionRelationship.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49154_1_1572
                if (reqDto != null) {
                    deptPositionRelationship.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:49151_1_1572
                }
                if (organization != null) {
                    deptPositionRelationship.setOrgEntityId(organization.getOrganizationId());//SimpleFieldAssign//sourceId:49153_1_1572
                    deptPositionRelationship.setOrganizationId(organization.getOrganizationId());//SimpleFieldAssign//sourceId:49155_1_1572
                }

                /*1-3-11新增组织部门职务（组织职务）[185]   */
                Assert.isNull(deptPositionRelationship.getPositionId(), "D1-3-修改职务-1-3-11新增组织部门职务（组织职务）-职务ID不能为空", false);
                Assert.isNull(deptPositionRelationship.getOrgTypeCode(), "D1-3-修改职务-1-3-11新增组织部门职务（组织职务）-所属实例类型编码不能为空", false);
                Assert.isNull(deptPositionRelationship.getOrgEntityId(), "D1-3-修改职务-1-3-11新增组织部门职务（组织职务）-所属对象实例ID不能为空", false);
                Assert.isNull(deptPositionRelationship.getSubjectLifeCycle(), "D1-3-修改职务-1-3-11新增组织部门职务（组织职务）-主体生命周期不能为空", false);
                Assert.isNull(deptPositionRelationship.getOrganizationId(), "D1-3-修改职务-1-3-11新增组织部门职务（组织职务）-组织ID不能为空", false);
                string_2 = mDeptPositionRelationshipService.addOrgDeptPosition(deptPositionRelationship);


            }
//processBranchName:正常结束 ,processBranchId:1573

        } else if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID") && queryClassMatchResultToAnswerDetailComRespDto != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg() != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg().equals("TRUE"))) {
            //elseif((D1-3-修改职务.主体生命周期 等于 当前有效 and D2-3查询分组匹配结果转答案(公共)(跨服务）.是否开启多组织 等于 是))  1574

            String string_4 = null;
            StaffingAccount staffingAccount_1 = new StaffingAccount();
            staffingAccount_1.setTypeCode("POSITION");//sourceId:49158_1_1575
            staffingAccount_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:49160_1_1575
            if (reqDto != null) {
                staffingAccount_1.setEntityId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:49159_1_1575
            }

            /*1-3-14新增编制账户[171]   */
            Assert.isNull(staffingAccount_1.getTypeCode(), "D1-3-修改职务-1-3-14新增编制账户-所属对象实例类型不能为空", false);
            Assert.isNull(staffingAccount_1.getEntityId(), "D1-3-修改职务-1-3-14新增编制账户-所属对象实例ID不能为空", false);
            Assert.isNull(staffingAccount_1.getSubjectLifeCycle(), "D1-3-修改职务-1-3-14新增编制账户-主体生命周期不能为空", false);
            string_4 = mStaffingAccountService.addStaffingAccount(staffingAccount_1);


//processBranchName:正常结束 ,processBranchId:1576

        } else if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("EDITING"))) {
            //elseif(D1-3-修改职务.主体生命周期 等于 正在编辑)  1577

//processBranchName:正常结束 ,processBranchId:1578

        }
        UpdatePositionRespDto retData = new UpdatePositionRespDto();


        return retData;
    }

    /**
     * D1-3-新增职务[806]
     * gen by moon at 10/2/2022, 7:48:48 AM
     */
    @Trace(operationName = "D1-3-新增职务")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddPositionRespDto addPosition(AddPositionReqDto reqDto) {


        String string_1 = null;
        String string_3 = null;
        String string_5 = null;
//virtualUsage 1-3-05新增职务  1477
        String string = null;
        Position position = new Position();
        if (reqDto != null) {
            position.setPositionIdName(reqDto.getPositionIdName());//SimpleFieldAssign//sourceId:16422_1_1477
            position.setPositionIdNameId(reqDto.getPositionIdNameId());//SimpleFieldAssign//sourceId:16423_1_1477
            position.setPositionNumber(reqDto.getPositionNumber());//SimpleFieldAssign//sourceId:16435_1_1477
            position.setPositionGradeId(reqDto.getPositionGradeId());//SimpleFieldAssign//sourceId:16426_1_1477
            position.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:16427_1_1477
            position.setTypeDictionaryId(reqDto.getTypeDictionaryId());//SimpleFieldAssign//sourceId:16428_1_1477
            position.setPositionDutyDesc(reqDto.getPositionDutyDesc());//SimpleFieldAssign//sourceId:16430_1_1477
            position.setPositionTargetDesc(reqDto.getPositionTargetDesc());//SimpleFieldAssign//sourceId:16431_1_1477
            position.setPositionType(reqDto.getPositionType());//SimpleFieldAssign//sourceId:16424_1_1477
            position.setIsOrgPosition(reqDto.getIsOrgPosition());//SimpleFieldAssign//sourceId:47363_1_1477
            position.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47376_1_1477
        }

        /*1-3-05新增职务[143]   */
        Assert.isNull(position.getPositionIdName(), "D1-3-新增职务-1-3-05新增职务-冗余职务名称不能为空", false);
        Assert.isNull(position.getPositionIdNameId(), "D1-3-新增职务-1-3-05新增职务-关联职务名称ID不能为空", false);
        Assert.isNull(position.getPositionNumber(), "D1-3-新增职务-1-3-05新增职务-职务编号不能为空", false);
        Assert.isNull(position.getPositionType(), "D1-3-新增职务-1-3-05新增职务- 职务性质不能为空", false);
        Assert.isNull(position.getIsOrgPosition(), "D1-3-新增职务-1-3-05新增职务-是否可用于分管领导职务不能为空", false);
        Assert.isNull(position.getSubjectLifeCycle(), "D1-3-新增职务-1-3-05新增职务-主体生命周期不能为空", false);
        string = mPositionService.addPosition(position);


        string_1 = string;
//virtualUsage D2-3查询分组匹配结果转答案(公共)(跨服务）  5668
        QueryClassMatchResultToAnswerDetailComRespDto queryClassMatchResultToAnswerDetailComRespDto = null;
        QueryClassMatchResultToAnswerDetailComReqDto queryClassMatchResultToAnswerDetailComReqDto = new QueryClassMatchResultToAnswerDetailComReqDto();
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:105905_1_5668
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjType("TENANT_SPACE");//sourceId:105906_1_5668
        queryClassMatchResultToAnswerDetailComReqDto.setConfItemClassCode("ORG_SET_CLASS");//CUSTOM_CONVENTION//sourceId:105864_1_5668
        queryClassMatchResultToAnswerDetailComReqDto.setIsInitialScheme("TRUE");//sourceId:308516_1_5668
        queryClassMatchResultToAnswerDetailComReqDto.setIsPlatData("FALSE");//sourceId:308517_1_5668

        /*D2-3查询分组匹配结果转答案(公共)(跨服务）[3088]   */
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getResultAspObjId(), "D1-3-新增职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-答案归属对象ID不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getResultAspObjType(), "D1-3-新增职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-答案归属对象类型不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getConfItemClassCode(), "D1-3-新增职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-分组标识不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsInitialScheme(), "D1-3-新增职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否初始方案答案不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsPlatData(), "D1-3-新增职务-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否平台数据不能为空", false);
        queryClassMatchResultToAnswerDetailComRespDto = confSchemeService.queryClassMatchResultToAnswerDetailCom(queryClassMatchResultToAnswerDetailComReqDto).getData();


        if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID") && queryClassMatchResultToAnswerDetailComRespDto != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg() != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg().equals("FALSE"))) {
            //if((D1-3-新增职务.主体生命周期 等于 当前有效 and D2-3查询分组匹配结果转答案(公共)(跨服务）.是否开启多组织 等于 否))  1480

            String string_2 = null;
            if (string != null) {
                StaffingAccount staffingAccount = new StaffingAccount();
                staffingAccount.setTypeCode("POSITION");//sourceId:35478_1_1496
                staffingAccount.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:47375_1_1496
                if (string != null) {
                    staffingAccount.setEntityId(string);//SimpleFieldAssign//sourceId:35479_1_1496
                }

                /*1-3-14新增编制账户[171]   */
                Assert.isNull(staffingAccount.getTypeCode(), "D1-3-新增职务-1-3-14新增编制账户-所属对象实例类型不能为空", false);
                Assert.isNull(staffingAccount.getEntityId(), "D1-3-新增职务-1-3-14新增编制账户-所属对象实例ID不能为空", false);
                Assert.isNull(staffingAccount.getSubjectLifeCycle(), "D1-3-新增职务-1-3-14新增编制账户-主体生命周期不能为空", false);
                string_2 = mStaffingAccountService.addStaffingAccount(staffingAccount);


                string_3 = string_2;
            }
            Organization organization = null;
            QueryOrgDetailReq queryOrgDetailReq = new QueryOrgDetailReq();
            queryOrgDetailReq.setIsHighOrg("TRUE");//sourceId:47378_1_1497
            queryOrgDetailReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:39835_1_1497

            /*1-3-12查询组织详情（查最高组织ID）[201]   */
            Assert.isNull(queryOrgDetailReq.getIsHighOrg(), "D1-3-新增职务-1-3-12查询组织详情（查最高组织ID）-是否最高组织不能为空", false);
            Assert.isNull(queryOrgDetailReq.getSpaceId(), "D1-3-新增职务-1-3-12查询组织详情（查最高组织ID）-创建于空间ID不能为空", false);
            organization = mOrganizationService.queryOrgDetail(queryOrgDetailReq);


            String string_4 = null;
            if (string != null && organization != null) {
                DeptPositionRelationship deptPositionRelationship = new DeptPositionRelationship();
                deptPositionRelationship.setOrgTypeCode("ORGANIZATION");//sourceId:35489_1_1498
                if (string != null) {
                    deptPositionRelationship.setPositionId(string);//SimpleFieldAssign//sourceId:35488_1_1498
                }
                if (organization != null) {
                    deptPositionRelationship.setOrgEntityId(organization.getOrganizationId());//SimpleFieldAssign//sourceId:17388_1_1498
                    deptPositionRelationship.setOrganizationId(organization.getOrganizationId());//SimpleFieldAssign//sourceId:47425_1_1498
                }
                if (reqDto != null) {
                    deptPositionRelationship.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:47379_1_1498
                }

                /*1-3-11新增组织部门职务（组织职务）[185]   */
                Assert.isNull(deptPositionRelationship.getPositionId(), "D1-3-新增职务-1-3-11新增组织部门职务（组织职务）-职务ID不能为空", false);
                Assert.isNull(deptPositionRelationship.getOrgTypeCode(), "D1-3-新增职务-1-3-11新增组织部门职务（组织职务）-所属实例类型编码不能为空", false);
                Assert.isNull(deptPositionRelationship.getOrgEntityId(), "D1-3-新增职务-1-3-11新增组织部门职务（组织职务）-所属对象实例ID不能为空", false);
                Assert.isNull(deptPositionRelationship.getSubjectLifeCycle(), "D1-3-新增职务-1-3-11新增组织部门职务（组织职务）-主体生命周期不能为空", false);
                Assert.isNull(deptPositionRelationship.getOrganizationId(), "D1-3-新增职务-1-3-11新增组织部门职务（组织职务）-组织ID不能为空", false);
                string_4 = mDeptPositionRelationshipService.addOrgDeptPosition(deptPositionRelationship);


                string_5 = string_4;
            }
//processBranchName:正常结束 ,processBranchId:1499

        } else if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID") && queryClassMatchResultToAnswerDetailComRespDto != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg() != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg().equals("TRUE"))) {
            //elseif((D1-3-新增职务.主体生命周期 等于 当前有效 and D2-3查询分组匹配结果转答案(公共)(跨服务）.是否开启多组织 等于 是))  1505

            String string_6 = null;
            if (string != null) {
                StaffingAccount staffingAccount_1 = new StaffingAccount();
                staffingAccount_1.setTypeCode("POSITION");//sourceId:35478_1_1506
                staffingAccount_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:47375_1_1506
                if (string != null) {
                    staffingAccount_1.setEntityId(string);//SimpleFieldAssign//sourceId:35479_1_1506
                }

                /*1-3-14新增编制账户[171]   */
                Assert.isNull(staffingAccount_1.getTypeCode(), "D1-3-新增职务-1-3-14新增编制账户-所属对象实例类型不能为空", false);
                Assert.isNull(staffingAccount_1.getEntityId(), "D1-3-新增职务-1-3-14新增编制账户-所属对象实例ID不能为空", false);
                Assert.isNull(staffingAccount_1.getSubjectLifeCycle(), "D1-3-新增职务-1-3-14新增编制账户-主体生命周期不能为空", false);
                string_6 = mStaffingAccountService.addStaffingAccount(staffingAccount_1);


                string_3 = string_6;
            }
//processBranchName:正常结束 ,processBranchId:1507

        } else if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("EDITING"))) {
            //elseif(D1-3-新增职务.主体生命周期 等于 正在编辑)  1508

//processBranchName:正常结束 ,processBranchId:1509

        }
        AddPositionRespDto retData = new AddPositionRespDto();
        if (string_1 != null) {
            retData.setPositionId(string_1);//SimpleFieldAssign//sourceId:35678_1
        }
        if (string_3 != null) {
            retData.setStaffingAccountId(string_3);//SimpleFieldAssign//sourceId:35679_1
        }
        if (string_5 != null) {
            retData.setOrgPositionRelationshipId(string_5);//SimpleFieldAssign//sourceId:35680_1
        }


        return retData;
    }

    /**
     * D1-3查询职务详情(边界)[3940]
     * gen by moon at 10/2/2022, 4:39:34 AM
     */
    @Trace(operationName = "D1-3查询职务详情(边界)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryPositionDetailBorderRespDto queryPositionDetailBorder(QueryPositionDetailBorderReqDto reqDto) {


        Position position_1 = null;
//步骤0: 1-3-05查询职务详情 - queryPositionDetail
        Position position = null;
        QueryPositionDetailReq queryPositionDetailReq = new QueryPositionDetailReq();
        queryPositionDetailReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:201675_1
        if (reqDto != null) {
            queryPositionDetailReq.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:201645_1
            queryPositionDetailReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:201662_1
        }

        /*1-3-05查询职务详情[146]   */
        Assert.isNull(queryPositionDetailReq.getPositionId(), "D1-3查询职务详情(边界)-1-3-05查询职务详情-职务ID不能为空", false);
        Assert.isNull(queryPositionDetailReq.getSubjectLifeCycle(), "D1-3查询职务详情(边界)-1-3-05查询职务详情-主体生命周期不能为空", false);
        Assert.isNull(queryPositionDetailReq.getSpaceId(), "D1-3查询职务详情(边界)-1-3-05查询职务详情-创建于空间ID不能为空", false);
        position = mPositionService.queryPositionDetail(queryPositionDetailReq);


        position_1 = position;

        QueryPositionDetailBorderRespDto retData = new QueryPositionDetailBorderRespDto();
        if (position_1 != null) {
            retData.setPositionId(position_1.getPositionId());//SimpleFieldAssign//sourceId:201678_1
            retData.setPositionNumber(position_1.getPositionNumber());//SimpleFieldAssign//sourceId:201679_1
            retData.setPositionIdName(position_1.getPositionIdName());//SimpleFieldAssign//sourceId:201680_1
            retData.setPositionType(position_1.getPositionType());//SimpleFieldAssign//sourceId:201681_1
            retData.setPositionDutyDesc(position_1.getPositionDutyDesc());//SimpleFieldAssign//sourceId:201682_1
            retData.setPositionTargetDesc(position_1.getPositionTargetDesc());//SimpleFieldAssign//sourceId:201683_1
        }


        return retData;
    }
    //
}
